package com.test.dao;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.test.entity.Products;
@Repository
public class ProductImpl implements ProductDao {

	@Autowired
	private SessionFactory sessionFactory;

//	private Session getCurrentSession() {
//		Session session = sessionFactory.openSession();
//		return sessionFactory.getCurrentSession();
//	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Products> getAll() {
		// TODO Auto-generated method stub
		 Session session = sessionFactory.openSession();  
		List<Products> list = session.createQuery("from Products").list();
		session.close();
		return list;
	}

}
